SIMD type microprocessor and a method of sort processing

ABSTRACT

The present invention provides an SIMD type microprocessor having a plurality of processor elements, wherein data stored in a specific register included in each processor element and data stored in an operand-designated source register are compared based on a first instruction; after the comparison, a larger data is stored in the specific register; and a smaller data is stored in the source register or an operand-designated destination register other than the source register.

BACKGROUND OF THE INVENTION

[0001] 1. Field of the Invention

[0002] The present invention relates to an SIMD (Single Instruction-stream Multiple Data-stream) type microprocessor.

[0003] 2. Description of the Related Art

[0004] In SIMD microprocessors, one instruction can simultaneously perform the same operation processing on a plurality of data. Because of this performance, such microprocessors are frequently utilized in processing such as image processing in which the same operations are performed on a lot of data.

[0005] In normal operation processing in an SIMD microprocessor, a plurality of operation units (Processor Elements (PE)) are arranged, and the same operations are simultaneously performed on a plurality of data. In this manner, high speed operation processing can be achieved.

[0006] In “image data processing”, a variety of filtering processing ways are performed in order to correct image quality. Normal filtering processing uses a weighted operation of an object pixel and pixels adjacent to main scanning direction or sub scanning direction, and therefore an SIMD type microprocessor is really suitable because of its simultaneous operation function. Although a normal weighting filter can be used for removing noise components of input image data, such kind of weighting filter has defect that contour portions are blurred.

[0007] A “median filter” is known as a useful tool for removing noises in input image data. This filter is frequently used in image processing because it can remove noise components with keeping contour portions clear.

[0008] This “median filter” performs such operation that an object pixel (or pixel at issue) and surrounding 8 pixels consisting of left pixel, right pixel, upper pixel, lower pixel, left upper pixel, right upper pixel, left lower pixel and right lower pixel) are lined in data magnitude order, and that the median pixel (placed at the center) replaces the object pixel.

[0009] In an SIMD type microprocessor, as shown in FIG. 5, pixel data are stored in PE registers (R2 registers in FIG. 5(B)) in main scanning direction. In order to refer to or obtain pixel data in sub scanning direction, line delay is required to be made by copying the present line pixel data to another registers (R1 registers in FIG. 5(B)) and storing the data in line buffers such as FIFO memory external to the SIMD type microprocessor. By repeating this operation several times, pixels can be referred to along a plurality of the sub scanning directions. In FIG. 5(B), R1 registers are line-delayed to make R0 registers.

[0010] In median filter processing, it is necessary for each PE to take (or fix) the “median” relating to pixels surrounding its pixel itself. In FIG. 5(B), PE[5] is taken as an example. The object pixel datum is a pixel “E” stored in R1 register of PE[5]. Its left upper pixel datum is a pixel “A” stored in R0 register of PE[4]. Its left pixel datum is a pixel “D” stored in R1 register of PE[4]. Its left lower pixel datum is a pixel “G” stored in R2 register of PE[4]. Its right upper pixel datum is a pixel “C” stored in R0 register of PE[6]. Its left pixel datum is a pixel “F” stored in R1 register of PE[6]. Its left lower pixel datum is a pixel “I” stored in R2 register of PE[6]. The numbers affixed to PE and register numbers (R0, R1, R2) will be explained later.

[0011] The above nice pixel data “A”, “B”, “C”, “D”, “E”, “F”, “G”, “H”, “I” are sorted based on data magnitude to obtain the median (value at the center) that is the fifth largest pixel data. Prior art needed to repeat sort processing of pixel data many times. A method of easing such bulky sort processing or speeding up the processing has been desired.

[0012] There is a method of speeding up the median filter processing, that is not relating to an SIMD microprocessor. For example, Japanese Patent Laid-open No. 6-274617 deals “3×3” pixel median filter processing, in which sort processing is separated to three stages so that three pixels is first sorted, then six pixels are merge-sorted and then nine pixels are merge-sorted finally to speed up the processing. Another method is disclosed in Japanese Patent Laid-open No. 5-2645, in which an object data are divided into bit slices and the number of data having “1” are counted from significant bit to insignificant bit to obtain data for desired order. Both methods can effectively speed up the median processing in an SISD type processor or an image processing LSI.

[0013] However, the above methods can not be applied to image processing using an SIMD type microprocessor.

[0014] The method described in Japanese Patent Laid-open No. 6-274617 can speed up the total speed of the merge-sorting of six pixels and nine pixels for an SISD type microprocessor that can perform branch processing. However, this method slows down the processing time for an SIMD type microprocessor because that the branch processing can not be performed on PE by PE basis and all branched operations have to be done.

[0015] The method disclosed in Japanese Patent Laid-open No. 5-2645, divides an object data into bit slices and counts the number of data having “1” from significant bit to insignificant bit to obtain data for desired order. If this method is applied to an SIMD type microprocessor, because both pixel data on both sides of an object pixel are stored in adjacent PE registers, data should be extracted from adjacent PE registers in order to make data divided into bit slices, increasing the number of wiring. Further, if counters and adders for bit slices are provided for all bits of each PE, circuit size will be unrealistically increased. If processing is divided to perform for each bit, the cycle time will be drastically increased.

[0016] Japanese Patent Laid-open No. 11-149554 discloses a median filter processing in an SIMD type microprocessor, in which “3×3 pixels” are calculated. First, three pixels are sorted in the “column” direction. Then the sorted three pixel data are sorted in the “row” direction. Lastly, sort is performed in the diagonal direction.

[0017] This method does not disclose the basic “three pixel sort processing”, and therefore the basic “pixel sort processing” can not be performed with high speed. If the “three pixel sort processing” consumes long time, the total processing time is proportionally increased. Prior art SIMD type microprocessors perform the following method in order to sort the three pixels.

[0018] In the following method, three pixel data to be compared are stored in R0, R1 and R2 registers of each PE. Sorted data are stored in R16, R17 and R18 registers in descendent order. “MAX” instruction means an instruction to compare two source register contents and write back the bigger data into a designated register. “MIN” instruction means an instruction to compare two source register contents and write back the smaller data into a designated register.

[0019] 1. Perform MAX operation on R0 and R1 and store the result in R16;

[0020] 2. Perform MIN operation on R0 and R1 and store the result in R17;

[0021] 3. Perform MIN operation on R2 and R17 and store the result in R18;

[0022] 4. Perform MAX operation on R2 and R17 and store the result in R17;

[0023] 5. Perform MAX operation on R16 and R17 and store the result in R16; and

[0024] 6. Perform MIN operation on R16 and R17 and store the result in R17.

[0025] The above explained six cycles are needed.

[0026] In order to do “3×3 pixels” median filtering processing according to the method disclosed in Japanese Patent Laid-open No. 11-149554, the following cycles are needed.

[0027] (1) Sort the 3×3 pixel data in the “column” direction (three columns can be carried out simultaneously due to “SIMD”); six cycles

[0028] (2) Sort the 3×3 pixel data in the “row” direction; 10 cycles for three lines

[0029] (3) Sort the 3×3 pixel data in the diagonal direction; six cycle

[0030] 22 cycles are needed in total. In (2) above, when obtaining the three 3×3 pixel's MIN and MAX, sorting is not necessary and 2 cycles are enough, which is shorter than 18 cycles required for sorting three lines.

SUMMARY OF THE INVENTION

[0031] It is an object of the present invention to provide a method of data sorting processing with high speed on each processor element of an SIMD microprocessor.

[0032] gateway unit, a controlling method thereof and a communication system that substantially obviate one or more of the problems caused by the limitations and disadvantages of the related art previously described.

[0033] Features and advantages of the present invention will be set forth in the description which follows, and in part will become apparent from the description and the accompanying drawings, or may be learned by practice of the invention according to the teachings provided in the description. Objects as well as other features and advantages of the present invention will be realized and attained by an SIMD type microprocessor having a plurality of processor elements, wherein data stored in a specific register included in each processor element and data stored in an operand-designated source register are compared based on a first instruction; after the comparison, a larger data is stored in the specific register; and a smaller data is stored in the source register or an operand-designated destination register other than the source register.

BRIEF DESCRIPTION OF THE DRAWINGS

[0034]FIG. 1 shows a block diagram of an SIMD type microprocessor according to the present invention;

[0035]FIG. 2 shows in more detail a block diagram of an SIMD type microprocessor according to the present invention;

[0036]FIG. 3 shows a block diagram of an SIMD type microprocessor according to the first embodiment of the present invention, illustrating an enlarged block diagram of one processor element portion;

[0037]FIG. 4 shows a block diagram of an SIMD type microprocessor according to the second embodiment of the present invention, illustrating an enlarged block diagram of one processor element portion;

[0038]FIG. 5 shows corresponding relation between image pixels and registers;

[0039]FIG. 6 shows a concept and flow (1) of median filter sort processing in “3×3” area according to the present invention;

[0040]FIG. 7 shows a concept and flow (2) of median filter sort processing in “3×3” area according to the present invention;

[0041]FIG. 8 shows a concept and flow (3) of median filter sort processing in “3×3” area according to the present invention;

[0042]FIG. 9 shows a concept and flow (4) of median filter sort processing in “3×3” area according to the present invention;

DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0043] In the following, embodiments of the present invention will be described with reference to the accompanying drawings.

[0044] Further, the present invention is not limited to these embodiments, but various variations and modifications may be made without departing from the scope of the present invention.

[0045]FIG. 1 shows a block diagram of an SIMD type microprocessor according to an embodiment of the present invention. The SIMD type microprocessor 2 includes a global processor 4, a register file 6 and an operation array 8.

[0046] (1) Global Processor 4

[0047] This global processor 4 is a so-called an SISD type processor, and includes a program RAM 10 and a data RAM 12 (see FIG. 2), and-interprets program and generates many control signals. These control signal are supplied to the register file 6 and the operation array 8 as well as to each built-in block. When the GP (Global Processor) executes instructions, it uses built-in general purpose registers, ALU (Arithmetic Logic Unit) and the like to perform many operations and do program controls.

[0048] (2) Register File 6

[0049] The register file 6 keeps data to be processed by PE (processor Element) instructions. A PE (processor element) 3 is, as well known, a unit by which an SIMD (Single Instruction-Stream, Multiple Data-Stream) type processor performs individual operation. As shown by the register file 6 and the operation array 8 in FIG. 2, an SIMD type microprocessor 2 shown in FIG. 2 includes 256 PEs 3. The above mentioned PE instructions are SIMD type instructions and executes the same operation simultaneously on a plurality of data stored in the register file 6. Reading from and writing into the register file 6 are controlled by the global processor 4. Data read out is supplied to and processed by the operation array 8, then written into the register file 6.

[0050] The register file 6 can be accessed from outside of the processor 2. Specified registers can be read out/written into from outside independently of the control by the global processor 4.

[0051] (3) Operation Array

[0052] Operations based on PE instructions are executed. The operations are all controlled by the global processor 4.

[0053]FIG. 2 shows the structure of the SIMD processor according to present invention in more detail.

[0054] A global processor 4 has a program RAM 10 for storing program for the processor 2, and a data RAM 12 for storing operation data. Further included are a program counter (PC) 14 for storing the address of the program, general purpose registers G0, G1, G2 and G3 (16, 18, 20, 22), a stack pointer (SP) 24 for storing the address of data RAM saving register contents, a link register (LS) 26 storing the address of place which called a subroutine, an LI register 28 and LN register 30 for storing branching addresses when requesting IRQ (Interrrupt ReQuest) and NMI (Non-Maskable Interrupt request), and a processor status register (P) 32 for storing the status of the processor.

[0055] These registers and an instruction decoder, ALU, SCU (sequential unit), a memory control circuit, an interrupt control circuit, an external I/O control circuit and a GP operation control circuit (not shown) are used for executing the GP instructions.

[0056] When executing the PE instructions, an instruction decoder (not shown), a register file control circuit (not shown), PE operation control circuit (not shown) are used for controlling the register file 6 and operation array 8. Data can be transferred from the data RAM 12 to a plurality of PE register files 6.

[0057] In the register files 6, 32 8-bit registers are built in each PE unit. 32 registers for each of 256 PEs are arrayed. The registers 34 are called R0, R1, R2, . . . R31 for each PE. Each register 34 has one reading port and one writing port for the operation array 8, and is accessed by the operation array 8 with using an 8-bit read/write bus. 24 registers (R0-R23) out of 32 registers can be accessed from outside of processor, and any register can be read/written from outside by inputting clock (CLK), address (Address) and read/write control (CWB). The remaining 8 registers (R24-R31) are used for temporarily storing operation data when performing PE operations.

[0058] The operation array 8 includes a 16-bit ALU 36, a 16-bit A register 38, one or plural F register 40. The operations instructed by PE instruction are normally performed so that data read out from the register file 6 or given by the global processor 4 is inputted to one port of the ALU 36 and the contents of the A register 38 is inputted to the other port of the ALU 36. The result of the operation is stored in the A register 38. Therefore, operation is normally performed on data obtained from R0-R31 registers 34 or the global processor 4 and data stored in the A register 38.

[0059] 7 to 1 multiplexers 42 are provided between the register file 6 and the operation array 8. As shown in FIG. 2, one multiplexer 42 can perform operation on data stored in R0-R31 registers 34 included in PE3 to which the multiplexer belongs, data stored in R0-R31 registers 34 included in left side three PE3, and data stored in R0-R31 registers 34 included in right side three PE3. 8-bit data in the register file 6 is shifted to the left by any bits by a shifting/extending circuit 44, and inputted to the ALU3.

[0060] An 8-bit condition register is included (not shown) for indicating valid/invalid for each PE3, and any specific PE3 can be selected as an operation object.

[0061] Each PE3 is assigned a number called “PE number”. In the SIMD type microprocessor shown in FIG. 2, because there exist 256 PEs, 8-bit bit sequence (256 kinds of 00000000b-11111111b, b means binary) is assigned as PE number to each PE3. The PE numbers are assigned from the leftmost to the right, but any numbering way is possible. PE[n] represents PE having PE number “n”. Therefore, the SIMD microprocessor in FIG. 2 has PE[0], PE[1], PE[2], PE[3], . . . PE[254], PE[255].

[0062] The above explained PE number data is created by changing the combination that an 8-bit input terminal of each PE3 is coupled to VCC or GND.

[0063] First Embodiment

[0064]FIG. 3 shows a block diagram of an SIMD microprocessor according to the first embodiment of the present invention, especially shows enlarged one PE3 portion.

[0065] An operation array 8 of each PE includes:

[0066] an ALU 36;

[0067] two ALU latches (ALT[1] 50-1, ALT[2] 502);

[0068] an A register 38 for storing operation result;

[0069] two F registers utilized as temporary registers (F1 register 40-1, F2 register 40-2); and

[0070] a CF (carry flag) 54 for latching a carry output from the ALU 36.

[0071] A multiplexer 52 inserted between the A register 38 and the ALU 36, selects one data out of three data that are ALU 3 operation result, the contents of two ALU latches (ALT[1] 50-1, ALT[2] 50-2), and stores the selected data to the A register 38. Control signals for controlling selection by the multiplexer 52 are:

[0072] a control signal [1] from the global processor 4; and

[0073] the carry output from the ALU 36.

[0074] In the ALU 36, when executing normal operation instructions, the operation result of the ALU 36 are inputted to the A register 38. When executing “MAXS” instruction or “MINS” instruction (explained later), it is preferable that the above mentioned control signal controls so that the carry selects either of ALT[1] or ALT[2] to input it to the A register 38.

[0075] F1 register 40-1 and F2 register 40-2 can transfer data from either ALT[1] or ALT[2], that is determined by a control line from the global processor 4. The A register 38 and two F registers (F1 register 40-1 and F2-register 40-2) have lines for outputting data onto a data bus 55. The output from the A register 38 is controlled by a control signal 2 from the global processor 4. The output from the two F registers (F1 register 40-1 and F2 register 40-2) are controlled by control signals 3, 4 and a value of the CF54.

[0076] The operation of the above described SIMD microprocessor according to the first embodiment of the present invention will be explained below.

[0077] First, explanation will be given for the case of executing “MAXS” instruction.

[0078] The contents of the A register 38 is initially inputted to ALT[2] 50-2. An operand-designated value of the source register is inputted to ALT[1] 50-1, and compared (subtracted) by the ALU 36. The comparison result is outputted as a “carry” from the ALU 36. After the comparison, a lager one (that is, MAXS instruction) of ALT[1] 50-1 and ALU[2] 50-2 is inputted to the A register 38 depending on the value of the “carry”.

[0079] The global processor controls so that the value of ALT [1] 50-1 is inputted to F1 register 401 and the value of ALT [2] 50-2 is inputted to F2 register 40-2.

[0080] Regarding data transfer to a destination register, the value of CF 54 latching the carry determines which of F1 register 40-1 and F2 register 40-2 should output data to the data bus 55. Therefore, a smaller value (at MAXS instruction) can be transferred.

[0081] It was assumed in the above embodiment that the source register and the destination register are separately operand-designated. The source register and the destination register can be designated by the same operand (source operand only). In this case, because of fewer operands it is advantageous with regard to instruction mapping.

[0082] Second, explanation will be given for the case of executing “MINS” instruction. The MINS instruction can be realized by reversing the comparison (subtraction) order in the ALU 36, opposite from the case of the MAXS instruction. Alternatively, the MINS instruction can be realized in another way where the inverted “carry” is inputted to the multiplexer 52 selecting input to the A register 38, the value of the ALT [2] 50-2 is inputted to the F1 register 40-1, and the value of the ALT [1] 50-1 is inputted to the F2 register 40-1. In this manner, the smaller data is stored in the A register 38 and the larger data is stored in the destination register, to the contrary to MAXS instruction execution.

[0083] Second Embodiment

[0084] In case where two data to be compared are no sign data, it is possible to judge the comparison result from the carry output. On the contrary, in case where the data to be compared are signed data, the comparison result should be judged from the EXCLUSIVE-OR of a negative bit (MSB of the subtraction result of the ALU 36) and an overflow bit.

[0085]FIG. 4 shows a block diagram of an SIMD type microprocessor 2 according to the second embodiment of the present invention, specifically shows an enlarged block diagram of one PE3 portion.

[0086] According to the structure shown in FIG. 4, both no sign data and signed data can be processed. Each flag (C:carry, V:overflow, N:negative) outputted from the ALU 36 is inputted to a multiplexer 52 which selects the input to an A register 38, and to a flag register block (PSR) 68. In case where the comparison data have no sign, the multiplexer 52 selects data to be inputted to the A register 38, depending on the carry. In case where the comparison data have sign, the multiplexer 52 selects data to be inputted to the A register, depending on the EXCLUSIVE-OR of the overflow bit and negative bit. The flag register block (PSR) 68 latches each flag. In case where the comparison data have no sign, a multiplexer 69 included in the PSR 68 outputs the carry flag as an output enable control signal for F1 register 40-1 and F2 register 40-2. In case where the comparison data have sign, the multiplexer 69 included in the PSR 68 outputs the EXCLUSIVE-OR of the overflow bit and negative bit as an output enable control signal for F1 register 40-1 and F2 register 40-2.

[0087] Basic Sort Processing

[0088] The SIMD type microprocessor 2 shown in FIG. 3 or 4 can effectively perform sort processing on already sorted data when new data are added.

[0089] Sort processing will be explained below in case where already sorted five data have been stored in each register of R0, R1, R2, R3, R4 (R0>=R1>=R2>=R3>=R4), and one unsorted data is added.

[0090] 1. load the unsorted data in the A register 38;

[0091] 2. compare the A register 38 and R4 data, store the larger data in the A register 38;

[0092] 3. compare the A register 38 and R3 data, store the larger data in the A register 38 and store the smaller data in the R4 register;

[0093] 4. compare the A register 38 and R2 data, store the larger data in the A register 38 and store the smaller data in the R3 register;

[0094] 5. compare the A register 38 and R1 data, store the larger data in the A register 38 and store the smaller data in the R2 register;

[0095] 6. compare the A register 38 and R0 data, store the larger data in the A register 38 and store the smaller data in the R1 register; and

[0096]7. store the contents of the A register 38 into the R0 register.

[0097] Because the A register keeps the data to be transferred to the significant side of the sort buffers (R0, R1, R2, R2, R3, R4), the above processing can be continued. The above processing is performed in the ascendant order, but can be performed in the descendant order.

[0098] Sort Processing for Three Data

[0099] Sort processing for three data using the SIMD microprocessor 2 according to the first or second embodiment will be explained below.

[0100] Data to be compared are stored in each register of R0, R1, R2 of each PE3. Sorted data will be stored in each register R16, R17, R18 of each PE3 (R16>=R17>=R18).

[0101] 1. load the contents of the R0 register into the A register 38;

[0102] 2. compare the A register 38 and R1 data, store the larger data in the A register 38 and store the smaller data in the R18 register;

[0103] 3. compare the A register 38 and R2 data, store the smaller data in the A register 38 and store the larger data in the R16 register;

[0104] 4. compare the A register 38 and R18 data, store the smaller data in the A register 38 and store the larger data in the R17 register; and

[0105] 5. store the contents of the A register 38 into the R18 register.

[0106] The following processing can perform the same sort processing as above.

[0107] 1. load the contents of the R0 register into the A register 38;

[0108] 2. compare the A register 38 and R1 data, store the smaller data in the A register 38 and store the larger data in the R16 register;

[0109] 3. compare the A register 38 and R2 data, store the larger data in the A register 38 and store the smaller data in the R18 register;

[0110] 4. compare the A register 38 and R16 data, store the larger data in the A register 38 and store the smaller data in the R17 register; and

[0111] 5. store the contents of the A register 38 into the R16 register.

[0112] Although prior art SIMD type processors needed six cycles, five cycles are enough in the present embodiment. In the above steps, the step of “1. load the contents of the R0 register into the A register 38” must have been performed before image processing. Therefore, one cycle can be further deleted by regarding the image data stored in the A register 38 as the initial object to be sorted.

[0113] Median Filter Processing

[0114] Median filter processing in “3×3” pixel region according to the present invention will be explained below.

[0115] In this case, the median (the central value) is the fifth data, and therefore five buffers are necessary as sorting buffers. Each register of R16, R17, R18, R19, R20 is used as the five buffers here. It is assumed that the uppermost line pixel data is stored in R0 registers in each PE3. The central pixel data is stored in R1 registers. The lowermost pixel data is stored in R2 registers. In the SIMD microprocessor 2, PE3 are arrayed in the mail scanning direction. The lowest pixel data (data in R2 registers) to the sub scanning direction are the present line data. R0 registers and R1 registers are delayed.

[0116] 1. load the data stored in the R2 register in the A register 38 (the present line data is usually already stored);

[0117] 2. compare the A register 38 and the data stored in R0 register in the next left PE and store the larger data in the A register 38 and store the smaller data in R20 register;

[0118] 3. compare the A register 38 and the data stored in R0 register in the same PE and store the smaller data in the A register 38 and store the larger data in R18 register;

[0119] 4. compare the A register 38 and R20 data, store the smaller data in the A register 38 and store the larger data in the R19 register;

[0120] 5. compare the A register 38 and the data stored in R0 register in the next right PE and store the larger data in the A register 38 and store the smaller data in the R20 register;

[0121] 6. compare the A register 38 and R19 data, store the larger data in the A register 38 and store the smaller data in the R19 register;

[0122] 7. compare the A register 38 and R18 data, store the larger data in the A register 38 and store the smaller data in the R18 register;

[0123] 8. compare the A register 38 and the data stored in R1 register in the next left PE, store the smaller data in the A register 38 and store the larger data in the R16 register;

[0124] 9. compare the A register 38 and R18 data, store the smaller data in the A register 38 and store the larger data in the R17 register;

[0125] 10. compare the A register 38 and R19 data, store the smaller data in the A register 38 and store the larger data in the R18 register;

[0126] 11. compare the A register 38 and R20 data, store the smaller data in the A register 38 and store the larger data in the R19 register;

[0127] 12. compare the A register 38 and the data stored in the R1 register in the same PE, store the larger data in the A register 38;

[0128] 13. compare the A register 38 and the data stored in the R19 register, store the larger data in the A register 38 and store the smaller data in the R20 register;

[0129] 14. compare the A register 38 and the data stored in the R18 register, store the larger data in the A register 38 and store the smaller data in the R19 register;

[0130] 15. compare the A register 38 and the data stored in the R17 register, store the larger data in the A register 38 and store the smaller data in the R18 register;

[0131] 16. compare the A register 38 and the data stored in the R16 register, store the larger data in the A register 38 and store the smaller data in the R17 register;

[0132] 17. compare the A register 38 and the data stored in the R1 register in the next right PE, store the smaller data in the A register 38 and store the larger data in the R16 register;

[0133] 18. compare the A register 38 and the data stored in the R17 register, store the smaller data in the A register 38 and store the larger data in the R17 register;

[0134] 19. compare the A register 38 and the data stored in the R18 register, store the smaller data in the A register 38 and store the larger data in the R18 register;

[0135] 20. compare the A register 38 and the data stored in the R19 register, store the smaller data in the A register 38 and store the larger data in the R19 register;

[0136] 21. compare the A register 38 and the data stored in the R20 register and store the larger data in the A register 38;

[0137] 22. compare the A register 38 and the data stored in the R2 register in the next left PE, store the larger data in the A register 38;

[0138] 23. compare the A register 38 and the data stored in the R19 register, store the larger data in the A register 38 and store the smaller data in the R20 register;

[0139] 24. compare the A register 38 and the data stored in the R18 register, store the larger data in the A register 38 and store the smaller data in the R19 register;

[0140] Here, the fourth data is fixed except the remaining one pixel, and therefore further sorting is not needed.

[0141] 25. load the data stored in the R2 register in the next right PE into the A register 38;

[0142] 26. compare the A register 38 and the data stored in the R20 register and store the larger data in the A register 38;

[0143] 27. compare the A register 38 and the data stored in the R19 register and store the smaller data in a desired register;

[0144]FIGS. 6, 7, 8 and 9 show the concept and flow of the above explained sort processing. In the figures, “Empty” means that a sort buffer is vacant, shadowed portions are source-instructed (3×3 pixels) or destination-designated (R16-R20 buffers). In hatched portions, data have been already compared (3×3 pixels), or data have been already stored (R16-R20 sort buffers).

[0145] The above explained processing has 27 cycles including “1.” cycle, and 26 cycles except “1.”. Therefore the number of cycles is a little bit larger than the invention described in Japanese Patent Laid-open No. 11-149554. However in the invention described in Japanese Patent Laid-open No. 11-149554, the number of data is limited (for example 3×3), because the number of data to be sorted should be products of natural numbers. On the contrary, the present invention can perform sort processing without depending on the number of data to be sorted.

[0146] According to the first or second embodiment of the present invention, two data can be compared with each other and the larger data (or smaller data) can be stored in a specific register, and the smaller data (or the larger data) can be stored in an operand-designated register. Therefore, without providing an SIMD type microprocessor with any sorting hardware, the time required for merging unsorted data with sorted data is significantly shortened.

[0147] Processing flow can be realized, which can shorten the processing time for sorting unsorted data. 

What is claimed is:
 1. An SIMD type microprocessor having a plurality of processor elements, wherein data stored in a specific register included in each processor element and data stored in an operand-designated source register are compared based on a first instruction; after the comparison, a larger data is stored in the specific register; and a smaller data is stored in the source register or an operand-designated destination register other than the source register.
 2. An SIMD type microprocessor having a plurality of processor elements, wherein data stored in a specific register included in each processor element and data stored in an operand-designated source register are compared based on a second instruction; after the comparison, a smaller data is stored in the specific register; and a larger data is stored in the source register or an operand-designated destination register other than the source register.
 3. An SIMD type microprocessor having a plurality of processor elements, wherein data stored in a specific register included in each processor element and data stored in an operand-designated source register are compared based on a first instruction; after the comparison, a larger data is stored in the specific register; a smaller data is stored in the source register or an operand-designated destination register other than the source register; and data stored in a specific register included in each processor element and data stored in an operand-designated source register are compared based on a second instruction; after the comparison, a smaller data is stored in the specific register; and a larger data is stored in the source register or an operand-designated destination register other than the source register.
 4. A method of sort processing n data in each processor element using the SIMD type microprocessor as claimed in claim 3 wherein: n (n is a natural number larger than 3) general purpose registers provided at each processor element are used as sort buffers in each processor element; n data are stored in each of the general purpose registers from a first register to nth register in order from large data to small data; said method comprising the steps of: (1) step 1 of loading a first data to be compared into a specific register; (2) step 2 of performing a first instructed operation on a second data to be compared and the specific register data, storing a smaller data in an nth register and storing a larger data in the specific register; (3) step 3 of performing a second instructed operation on a third data to be compared and the specific register data,-storing a larger data in an (n−2)th register and storing a smaller data in the specific register, and performing the second instructed operation on the nth register data and the specific register data, storing a larger data in an (n−1)th register and storing a smaller data in the specific register; (4) step 4 of performing the first instructed operation on a fourth data to be compared and the specific register data, storing a smaller data in the nth register and storing a larger data in the specific register, and performing the first instructed operation on the (n−1)th register data and the specific register data, storing a smaller data in the (n−1)th register and storing a larger data in the specific register, and further performing the first instructed operation on the (n−2)th register data and the specific register data, storing a smaller data in the (n−2)th register and storing a larger data in the specific register; (5) step 5 of performing the second instructed operation on a (2i−1)th data to be compared (i is a natural number larger than 2) and the specific register data, storing a larger data in an (n−(2i−2))th register and storing a smaller data in the specific register, and performing the second instructed operation on a (n−(2i−4))th data to be compared and the specific register data, storing a lager data in to a (n−(2i−3))th register and storing a smaller data in the specific register, then shifting data one by one by sort buffers from the first to the nth general purpose registers, performing the second instructed operation on data stored in the sort buffers of the general purpose registers and the specific register data, repeatedly storing a larger data in a previous register and performs data stored in the nth general purpose register and the second instructed operation, storing a larger data in the (n−1)th general purpose register and storing a smaller data in the specific register; (6) step 6 of performing the first instructed operation on a 2ith data to be compared and the specific register data, storing a smaller data in the nth general purpose register and storing a larger data in the specific register, further performing the first instructed operation on the (n−1)th general purpose register and the specific register, storing a smaller data in the (n−1) general purpose register and storing a smaller data in the (n−1)th general purpose and storing a larger data in the specific register; further then shifting data one by one by sort buffers from the nth to the first general purpose registers, performing the first instructed operation on data stored in the sort buffers of the general purpose registers and the specific register data, repeatedly storing a smaller data in the same general purpose register and performs the first instructed operation on data stored in the (n−(2i−2))th general purpose register and the specific register, storing a smaller data in the (n−(2i−2))th general purpose register and storing the larger data in the specific register; performing the step 1 , step 2, step 3 and step 4; repeating steps 5 and 6 with increasing i one by one until the data to be compared become the nth one; finishing the sort processing at the maximum end of the sort buffers when n is an even number, or finishing the sort processing at the minimum end of the sort buffers when n is an odd number.
 5. A method of sort processing n data in each processor element using the SIMD type microprocessor as claimed in claim 3 wherein: n (n>=4)general purpose registers provided at each processor element are used as sort buffers in each processor element; n data are stored in each of the general purpose registers from a first register to nth register in order from large data to small data; said method comprising the steps of: (1) step 1 of loading a first data to be compared into a specific register; (2) step 2 of performing a second instructed operation on a second data to be compared and the specific register data, storing a larger data in a first register and storing a smaller data in the specific register; (3) step 3 of performing a first instructed operation on a third data to be compared and the specific register data, storing a smaller data in a third register and storing a larger data in the specific register, and performing the first instructed operation on the first register data and the specific register data, storing a smaller data in a second register and storing a larger data in the specific register; (4) step 4 of performing the second instructed operation on a fourth data to be compared and the specific register data, storing a larger data in the first register and storing a smaller data in the specific register, and performing the second instructed operation on the second register data and the specific register data, storing a larger data in the second register and storing a smaller data in the specific register, and further performing the second instructed operation on the third register data and the specific register data, storing a larger data in the third register and storing a smaller data in the specific register; (5) step 5 of performing the first instructed operation on a (2i−1)th data to be compared (i is a natural number larger than 2) and the specific register data, storing a smaller data in an (2i−1)th register and storing a larger data in the specific register, and performing the first instructed operation on a (2i−3)th data to be compared and the specific register data, storing a smaller data in a (2i−2) register and storing a larger data in the specific register, then shifting data one by one by sort buffers from the nth to the first general purpose registers, performing the first instructed operation on data stored in the sort buffers of the general purpose registers and the specific register data, repeatedly storing a smaller data in a previous register and performs the first instructed operation on data stored in the first general purpose register and the specific register, storing a smaller data in the second register and storing a larger data in the specific register; (6) step 6 of performing the second instructed operation on a 2ith data to be compared and the specific register data, storing a larger data in the first general purpose register and storing a smaller data in the specific register, further performing the second instructed operation on the second general purpose register and the specific register, storing a larger data in the second general purpose register and storing a smaller data in the specific register; further then shifting data one by one by sort buffers from the first to nth general purpose registers, performing the second instructed operation on data stored in the sort buffers of the general purpose registers and the specific register data, repeatedly storing a larger data in the same general purpose register and performs the second instructed operation on data stored in the (2i−1)th general purpose register and the specific register data, storing a larger data in the (2i−1)th general purpose register and storing the smaller data in the specific register; performing the step 1 , step 2, step 3 and step 4; repeating steps 5 and 6 with increasing i one by one until the data to be compared become the nth one; finishing the sort processing at the minimum end of the sort buffers when n is an even number, or finishing the sort processing at the maximum end of the sort buffers when n is an odd number. 